home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt3sp1.arc / DUPL.PAS < prev    next >
Pascal/Delphi Source File  |  1985-05-09  |  2KB  |  41 lines

  1. (*--------------------------------------------------------------------------*)
  2. (*                     Dupl -- Duplicate a character n times                *)
  3. (*--------------------------------------------------------------------------*)
  4.  
  5. FUNCTION Dupl( Dup_char : Char; Dup_Count: INTEGER ) : AnyStr;
  6.  
  7. (*--------------------------------------------------------------------------*)
  8. (*                                                                          *)
  9. (*    Function: Dupl                                                        *)
  10. (*                                                                          *)
  11. (*    Purpose:  Duplicate a character n times                               *)
  12. (*                                                                          *)
  13. (*    Calling Sequence:                                                     *)
  14. (*                                                                          *)
  15. (*       Dup_String := Dupl( Dup_Char: Char; Dup_Count: INTEGER ): AnyStr;  *)
  16. (*                                                                          *)
  17. (*          Dup_Char   --- Character to be duplicated                       *)
  18. (*          Dup_Count  --- Number of times to duplicate character           *)
  19. (*          Dup_String --- Resultant duplicated string                      *)
  20. (*                                                                          *)
  21. (*          Note:  If Dup_Count <= 0, a null string is returned.            *)
  22. (*                                                                          *)
  23. (*    Calls:  None                                                          *)
  24. (*                                                                          *)
  25. (*--------------------------------------------------------------------------*)
  26.  
  27. VAR
  28.    S    : AnyStr;       (* Holds incomplete result *)
  29.    I    : INTEGER;      (* Counter                 *)
  30.  
  31. BEGIN (* Dupl *)
  32.  
  33.    S := '';
  34.  
  35.    FOR I := 1 to Dup_Count DO
  36.       S := S + Dup_Char;
  37.  
  38.    Dupl := S;
  39.  
  40. END   (* Dupl *);
  41.